home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFBIND / AESFSIMU.S < prev    next >
Text File  |  1993-03-26  |  9KB  |  222 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* AESFAST Public Domain GEM bindings.
  5. ;*    Maintenance:
  6. ;*     02/11/89 v1.1: This source file is new with this version.
  7. ;*
  8. ;*     04/07/89 v1.2:
  9. ;*              The calculation of the location of the prompt on the
  10. ;*              screen has been changed.    It was placed one boxchar height
  11. ;*              down on the screen, putting it right below the menu bar.
  12. ;*              This didn't look too good on a big-monitor system, so now
  13. ;*              it is calculated by centering the box, then subtracting a
  14. ;*              fixed offset from the centered Y to make it appear right
  15. ;*              above the fsel'er box.  The offset is 9 character heights,
  16. ;*              (plus 2 extra char heights for the prompt itself), less
  17. ;*              2 pixels (just to line everything up real neat).
  18. ;*
  19. ;*     07/22/89 v1.3:
  20. ;*              Bugfix...A 'bra.s' instruction was missing just before the
  21. ;*              'strcpy' routine, causing 4 bombs on a pre-1.4 machine.
  22. ;*
  23. ;*     03/13/93 v1.9:
  24. ;*              As a part of the conversion to JAS asm code, this module
  25. ;*              was split out as a separate item.  It is called from
  26. ;*              AESFSEL2.S and AESFSEL3.S.
  27. ;*========================================================================
  28.  
  29. ;*************************************************************************
  30. ;* Fsel Simulation stuff...
  31. ;*    The following is the object tree that displays the prompt on
  32. ;*    pre-TOS 1.4 systems, and the code to display that box.
  33. ;*************************************************************************
  34.  
  35. ;-------------------------------------------------------------------------
  36. ; Define the offsets within the AES block storage area.
  37. ;-------------------------------------------------------------------------
  38.  
  39. aespb      =         0                    ; 'aespb' MUST be first!...
  40. pcontrl   =         0                    ;    Pointer to control array
  41. pglobal   =         4                    ;    Pointer to global array
  42. pintin      =         8                    ;    Pointer to intin array
  43. pintout   =        12                    ;    Pointer to intout array
  44. padrin      =        16                    ;    Pointer to adrin array
  45. padrout   =        20                    ;    Pointer to adrout array
  46.  
  47. control   =        24                    ; Control array is next...
  48. function  =        24                    ;    Function code
  49. sintin      =        26                    ;    size of intin
  50. sintout   =        28                    ;    size of intout
  51. sadrin      =        30                    ;    size of adrin
  52. sadrout   =        32                    ;    size of adrout
  53.  
  54. global      =        34                    ; Global array, needs no further def.
  55.  
  56. ;-------------------------------------------------------------------------
  57. ; Define the TEDINFO and OBJECT structures for the prompt text.
  58. ;-------------------------------------------------------------------------
  59.  
  60.           data
  61.  
  62. YSZ_PROMPT    =        2
  63. YSZ_FSEL    =        9
  64. Y_OFFSET    =        YSZ_PROMPT+YSZ_FSEL
  65.  
  66. prmptext:            ;Teddef   0,0,0,3,0,TE_CNTR,$1180,0,1,31,0
  67.           dc.l        0,0,0
  68.           dc.w        3,0,2,$1180,0,1,31,0
  69.  
  70. prmptree:            ;Objdef   ,-1,-1,-1,G_BOXTEXT,LASTOB,NORMAL,0,0,0,40,YSZ_PROMPT
  71.           dc.w        -1,-1,-1            ; ob_head,next,tail
  72.           dc.w        22                    ; ob_type  = G_BOXTEXT
  73.           dc.w        $20                 ; ob_flags = LASTOB
  74.           dc.w        0                    ; ob_state = NORMAL
  75.           dc.l        prmptext            ; ob_spec  = &prmptext
  76.           dc.w        0,0,40,YSZ_PROMPT    ; ob_xywh
  77.  
  78. ;-------------------------------------------------------------------------
  79. ; Define variables.
  80. ;-------------------------------------------------------------------------
  81.  
  82. treeptr:  dc.l        prmptree   ; Ptr to tree: addrin for objc_draw() et. al.
  83.  
  84. dialstuf: dc.w        3           ; Here things get a little ugly: The storage
  85. azero:      dc.w        0,0        ; from 'dialstuff' down is the intin array
  86. prmpstob: dc.w        0           ; for form_dial(FMD_FINISH).  From prmpstob
  87. prmpdpth: dc.w        8           ; down, it is also the intin array for
  88. prmpclip: dc.w        0,0,0,0    ; objc_draw().
  89.  
  90. prmpflag: dc.w        0           ; Flag: Has one-time object fixup been done?
  91.  
  92.           text
  93.  
  94. ;-------------------------------------------------------------------------
  95. ; This routine lets us call AES more quickly than going through the
  96. ; routines in AESCOMN (and is better tailored to our needs here).
  97. ;-------------------------------------------------------------------------
  98.  
  99. aes_icall:
  100.  
  101.           movep.l    d0,control+1(a4)         ; fill in the control array (!),
  102.           move.l    a0,padrin(a4)             ; store the adrin ptr into aespb
  103.           move.l    a1,pintin(a4)             ; store the intin ptr into aespb
  104.           move.l    a2,pintout(a4)             ; store it into aespb
  105.           move.l    a4,d1                     ; move the aespb pointer to the
  106.           move.w    #$C8,d0                  ; interface register, also the AES
  107.           trap        #2                         ; function code, call AES, return
  108.           rts                                 ; to the calling binding routine.
  109.  
  110. ;-------------------------------------------------------------------------
  111. ; FselSimu - Simulate an exinput call on pre-TOS 1.4 systems.
  112. ;
  113. ;  On entry to this routine, a6 has been set up for accessing the
  114. ;  parameters of the call to fsel_exinput, and also for addressing
  115. ;  4 bytes of stack for temp vars as negative offsets from a6.    On
  116. ;  exit, intout[] at -4(a6) holds the return values from the fsel_input.
  117. ;-------------------------------------------------------------------------
  118.  
  119.           globl     FselSimu
  120.  
  121. FselSimu:
  122.  
  123.           movem.l    d2/a2-a5,-(sp)             ; Save registers.
  124.  
  125.           lea        aesblock,a4              ; Load aesblock base register.
  126.           lea        treeptr,a5                 ; we use this a lot.
  127.           move.l    (a5),a3                  ; load pointer to tree.
  128.  
  129.           tas        prmpflag                 ; Has first-time object tree fixup
  130.           bne.b     do_simulation             ; been done?  If so, continue below.
  131.  
  132. ;-------------------------------------------------------------------------
  133. ; Do the one-time object tree fixup:
  134. ;
  135. ;  - Plug in a couple of static integer values.
  136. ;  - Call rsrc_obfix  for resolution-specific x/y/w/h fixup.
  137. ;  - Call form_center to center box in the x coord & calc the clip area.
  138. ;  - Call graf_handle to get the height of a boxchar, and use this height
  139. ;     to calc the ob_y of the prompt box (and the clip area).
  140. ;-------------------------------------------------------------------------
  141.  
  142.           subq.l    #2,sp                     ; allocate intout[1]
  143.           move.l    sp,a2                     ; a2 -> intout
  144.           lea        azero,a1                 ; a1 -> intin
  145.           move.l    a5,a0                     ; a0 -> adrin
  146.           move.l    #$72010101,d0             ; rsrc_obfix() ; AControl 114,1,1,1
  147.           bsr        aes_icall                 ; do it.
  148.           addq.l    #2,sp                     ; we don't care about intout[0].
  149.  
  150.           sub.w     #10,sp                     ; Allocate intout[5]
  151.           move.l    sp,a2                     ; a2 -> intout
  152.           move.l    a5,a0                     ; a0 -> addrin (prmptree)
  153.           move.l    #$36000501,d0             ; form_center() ; AControl  54,0,5,1
  154.           bsr        aes_icall                 ; do it.
  155.           addq.l    #2,sp                     ; We don't care about intout[0],
  156.           move.l    (sp)+,prmpclip             ; the rest of intout is the
  157.           move.l    (sp)+,prmpclip+4         ; clip rectangle, save it.
  158.  
  159.           sub.w     #10,sp                     ; Allocate intout[5], make a2 point
  160.           move.l    sp,a2                     ; to it.  Do graf_handle(&stack).
  161.           move.l    #$4D000500,d0             ; graf_handle()  ; AControl  77,0,5,0
  162.           bsr        aes_icall                 ; We want the height of a char
  163.           addq.l    #4,sp                     ; which is in intout[2], put that
  164.           move.w    (sp)+,d0                 ; in d0, throw everything else away.
  165.           addq.l    #4,sp                     ; Calc the placement of the prompt
  166.           mulu        #Y_OFFSET,d0             ; box as Y_OFFSET characters up from
  167.           subq.w    #2,d0                     ; the current (centered) location,
  168.           sub.w     d0,18(a3)                 ; set the ob_y value in the tree
  169.           sub.w     d0,prmpclip+2             ; and clip rectange to this value.
  170.  
  171. ;-------------------------------------------------------------------------
  172. ; Once the one-time stuff is done (and on all subsequent calls...) do
  173. ; the actual simulation of the TOS 1.4 exinput:
  174. ;
  175. ;  - Plug the prompt string pointer into the TEDINFO.
  176. ;  - The prompt string is placed in a box above the fsel dialog box on the
  177. ;     screen (but below the menu bar) before the system fsel'er is called.
  178. ;     The prompt is displayed inside a box, (it's a BOXTEXT object, which
  179. ;     is the entire tree).  The prompt is displayed with an objc_draw, and
  180. ;     removed by sending a redraw message (via form_dial).
  181. ;  - Call fsel_input() (the old one).
  182. ;  - Call form_dial() to send a redraw message to clear the prompt box.
  183. ;  - Return to caller.
  184. ;-------------------------------------------------------------------------
  185.  
  186. do_simulation:
  187.  
  188. ;          .cargs    #8,pinpath.l,pinsel.l,pbutton.l,plabel.l
  189.  
  190. pinpath   =         8
  191. pinsel      =         12
  192. pbutton   =         16
  193. plabel      =         20
  194.  
  195.           move.l    plabel(a6),prmptext      ; Set prompt text pointer.
  196.  
  197.           subq.l    #2,sp                     ; allocate intout[1]
  198.           move.l    sp,a2                     ; a2 -> intout
  199.           lea        prmpstob,a1              ; a1 -> intin
  200.           move.l    a5,a0                     ; a0 -> addrin
  201.           move.l    #$2A060101,d0             ; objc_draw(prmptree,...) ; AControl  42,6,1,1
  202.           bsr        aes_icall                 ; do it.
  203.           addq.l    #2,sp                     ; throw away intout[0].
  204.  
  205.           lea        -4(a6),a2                 ; a2 -> intout
  206.           lea        pinpath(a6),a0             ; a0 -> addrin
  207.           move.l    #$5A000202,d0             ; fsel_input() ; AControl    90,0,2,2
  208.           bsr        aes_icall                 ; do it.
  209.  
  210.           subq.l    #2,sp                     ; allocate intout[1] for form_dial
  211.           move.l    sp,a2                     ; a2 -> intout
  212.           lea        dialstuf,a1              ; a1 -> intin
  213.           move.l    #$33090100,d0             ; form_dial(FMD_FINISH,...); AControl    51,9,1,0
  214.           bsr        aes_icall                 ; this sends a redraw message to
  215.           addq.l    #2,sp                     ; clean up our prompt text box.
  216.  
  217.           movem.l    (sp)+,d2/a2-a5             ; Restore working regs.
  218.           rts
  219.  
  220. ;          end of code
  221.  
  222.